package cn.t.service.order;

import cn.t.constants.CommonConstants;
import cn.t.core.service.ServiceImpl;
import cn.t.model.order.ExceptionLogDO;
import cn.t.repository.order.ExceptionLogRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备异常日志记录表(ExceptionLog)领域服务
 *
 * @author t
 * @since 2024-05-24 10:19:11
 */
@Slf4j
@Service
@AllArgsConstructor
public class ExceptionLogService extends ServiceImpl<ExceptionLogDO, ExceptionLogRepository> {
    public List<ExceptionLogDO>  queryListByNo(List<String> orderSns) {
        return repository.queryListByNo(orderSns);
    }

    public void saveBatch(List<ExceptionLogDO> exceptionLogDOS){
        repository.addBatch(exceptionLogDOS);
    }
    public Boolean updateBatch(List<ExceptionLogDO> exceptionLogDOS){
        return   repository.updateBatch(exceptionLogDOS);
    }

    public List<ExceptionLogDO> getExceptionLogs(Long firmId, Integer count, int businessType) {
        ExceptionLogDO queryParam = new ExceptionLogDO();
        queryParam.setFirmId(firmId);
        queryParam.setBusinessType(businessType);
        return this.findByModel(queryParam, CommonConstants.ZERO, count, "id", "desc");
    }
}
